<?php 
session_start();

// var_dump($_POST);

include_once('../../public/function.php');
$config = include_once('../../public/config.php');
$where =" where `admin`= '{$_POST['username']}'and `pwd`='{$_POST['pwd']}'";
$res = select($config,'admin',$where);
// var_dump($res[0]['admin']);die;
if($res){
	echo '<script>alert("登陆成功");window.location.href="index.php"</script>';
	$_SESSION['name']=$res[0]['admin'];
	$_SESSION['islogin']=1;

}else{
	echo '<script>alert("登陆失败,账号密码不匹配");window.location.href="admin.php"</script>';

}

 ?>